/*
 *  Copyright © 2018 - 2021 xulianqiang90@163.com. All Rights Reserved.
 */

package io.light.frame.dal.mybatis.generator.core.mapper.func;

import io.light.frame.dal.mybatis.generator.core.domain.mapper.MapperFunc;
import org.dom4j.Element;
import org.springframework.core.Ordered;

/**
 * Function builder
 *
 * @author Ivan
 * @version 1.0.0
 * @date 2021-05-22 03:46
 */
public interface FuncBuilder extends Ordered {

    /**
     * Accept this function`s element or not
     *
     * @param element    function element
     * @param mapperFunc {@link MapperFunc}
     * @return {@code boolean} accept or not
     */
    default boolean accept(Element element, MapperFunc mapperFunc) {
        return false;
    }

    /**
     * Build mapper function
     *
     * @param element    function element
     * @param mapperFunc {@link MapperFunc}
     * @param content    {@link MapperFunc.Content}
     */
    void build(Element element, MapperFunc mapperFunc, MapperFunc.Content content);

    /**
     * Order weight
     *
     * @return {@code int}
     */
    @Override
    default int getOrder() {
        return 0;
    }
}
